import request from "@/utils/request";

//登录请求的返回值类型
export interface loginTokenType {
  token: string;
}

//获取用户信息的返回值类型
export interface userInfoType {
  routes: string[];
  buttons: string[];
  roles: string[];
  name: string;
  avatar: string;
}

//1.登录
export const reqLogin = (username: string, password: string) => {
  return request.post<null, loginTokenType>("/admin/acl/index/login", {
    username,
    password,
  });
};

//2. 获取用户信息
export const reqUserInfo = () => {
  return request.get<null, userInfoType>("/admin/acl/index/info");
};

//3. 退出登录
export const reqLogout = () => {
  return request.post<null, null>(`/admin/acl/index/logout`);
};
